#include <bits/stdc++.h>
using namespace std;
int n;
int r[100002];
int t[100002];
int sum;
int ans;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&r[i]);
        t[r[i]]++;
    }
    for(int i=1;i<=100000;i++){
        if(t[i]!=0){
            if(t[i]>=sum){
                ans+=sum;
                sum=t[i];
            }
            else{
                ans+=t[i];
            }
        }
    }
    printf("%d\n",n-ans);
    return 0;
}
